home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
PROGRAMMING
/
DESKLIBC
/
SOURCES.ZIP
/
DeskLib
/
!DLSources
/
Libraries
/
File
/
c
/
AllocLoad
next >
Wrap
Text File
|
1995-08-29
|
1KB
|
44 lines
/*
#### # # # #
# # # # # The FreeWare C library for
# # ## ### # # # # ### RISC OS machines
# # # # # # # # # # # ___________________________________
# # #### ### ## # # # #
# # # # # # # # # # Please refer to the accompanying
#### ### #### # # ##### # ### documentation for conditions of use
________________________________________________________________________
File: File.AllocLoad.c
Author: Copyright © 1995 Julian Smith
Version: 1.01 (22 Jul 1995)
Mods: Changed name from File_AllocLoad to File_AllocLoad0
*/
#include <stdlib.h>
#include "DeskLib:File.h"
char *File_AllocLoad0( char *filename)
{
char *buffer;
int length;
if ( !File_Exists( filename)) return NULL;
File_GetLength( filename, &length);
buffer = malloc( 1+length);
if ( !buffer) return NULL;
if ( File_LoadTo( filename, buffer, NULL)) {
free( buffer);
return NULL;
}
buffer[ length] = 0;
return buffer;
}